Make a new field, and type these scripts in it
beep 3 flash 3 play boing play harpsichord play harpsichord "60q 62e" play harpsichord "60q 62e 64h. 66s 67h 60w" ask "type your choice" answer "select choice" with "HyperCard" or "Supercard" or "Neither" answer "Today is:" && the date answer "Today is:" && the long date answer "Its:" && the time && item1 of the long dateType the script below into the field script and make sure that the field is locked
on mouseUp select the clickLine put word 2 of the clickLine into lino do line lino of cd fld 1 end mouseUpNow try it out.
The key to this setup is these lines in the field script
put word 2 of the clickLine into lino
do line lino of cd fld 1
lino is a variable (a temporary container in this case)
the clickLine is a function peculiar to fields. It returns the line number and the field name containing the text in a field last clicked on by the user.
do is a keyword that carries out a HyperTalk statement
select the clickLine does the highlighting when the text is clicked on.
Fields that do things when you click on the individual lines are often used in HyperCard for such things as indexes.
For instance if you put all the card names of a stack in such a field they can be used to take the user to each card as they select its name from the index field.
Make a button under the field and type this script into it
on mouseUp do cd fld 1 end mouseUpWhen it is clicked the do keyword runs through the contents of the field statement by statement. The statements have to be separated by a return i.e they must be on separate lines. The statements can be in any container, a field , or a variable and they act just like script would that was made up of the same lines or statements.
The statement on line 8 of the field is an example of using Answer with three choices. When the user selects one of the buttons the message passed to hyperCard can then be made use of. Make a button and type this script into it.
on mouseUp answer "Select Choice" with "HyperCard" or "Supercard" or "Neither" if it is "HyperCard" then beep 2 if it is "Supercard" then play boing "45q" if it is "Neither" then put "Chicken" end mouseUpNotice that the last choice is a button with double line around it. This is the default button that is activated if the user presses the return key.
In this lesson some of the statements uses HyperCard's play command. This command plays prerecorded sounds as musical notes at varying tempos, pitches and lengths. HyperCard includs harpsichord, boing and flute as already installed sound resources.
Return to Index for more about sound and music